﻿/*
 * perifclk.c
 *
 * Created: 17.03.13 14:18:53
 *  Author: ЖЕНЯ
 */ 
#include <avr/io.h>
#include <avr/interrupt.h>

#include "perifclk.h"
#include "events.h"
#include "proc_events.h"

SIGNAL(SIG_OUTPUT_COMPARE0A)
{
	fastEventBitmask |= FEV_SYS_TIMER_COMPLETE;
	
}

void InitPerifClk(void)
{
	TCCR0B |= (1 << WGM01);
	// set up timer with prescaler = 64 and CTC mode
	TCCR0B |= (1 << CS01)|(1 << CS00);

	// initialize counter
	TCNT0 = 0;

	TIMSK0 |= (1<<OCIE0A);
	// initialize compare value
	OCR0A =		250;
}
